/*
 * Copyright (c) 2008 Benoit Bouchez, Nicolas Giard
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.noocodecommit.wicket.stuff.jquery.plugin.ui.magnifier;

import com.noocodecommit.wicket.stuff.jquery.plugin.JQPluginOptions;

/**
 * JQAccordion Option set
 * 
 * @author Benoit Bouchez
 * 
 */
public class JQMagnifierOptions extends JQPluginOptions implements Cloneable
{
	/** x axis value */
	public static final String AXIS_X = "x";
	/** y axis value */
	public static final String AXIS_Y = "y";

	private String axis;
	private String items = "> *";
	private int baseline = 0;
	private int distance = 150;
	private float magnification = 2f;
	private int opacityMin;
	private int opacityMax;
	private int zIndex;
	private float verticalLine = -0.5f;
	private boolean overlap = false;

	private String clickScript = "";

	/**
	 * Constructor
	 */
	public JQMagnifierOptions()
	{
		super();
		this.setDefaultHeader("magnifier");
	}

	/**
	 * Gets the axis value
	 * 
	 * @return the axis value
	 */
	public String getAxis()
	{
		return axis;
	}

	/**
	 * Sets the axis option value
	 * 
	 * @param axis
	 *            magnifier axis
	 */
	public void setAxis(String axis)
	{
		this.axis = axis;
		this.options.put("axis", "axis:'" + axis + "'");
	}

	/**
	 * Gets the items value
	 * 
	 * @return the items value
	 */
	public String getItems()
	{
		return items;
	}

	/**
	 * Sets the items option value
	 * 
	 * @param items
	 *            magnifier items
	 */
	public void setItems(String items)
	{
		this.items = items;
		this.options.put("items", "items:'" + items + "'");
	}

	/**
	 * Gets the baseline value
	 * 
	 * @return the baseline value
	 */
	public int getBaseline()
	{
		return baseline;
	}

	/**
	 * Sets the baseline option value
	 * 
	 * @param baseline
	 *            magnifier baseline
	 */
	public void setBaseline(int baseline)
	{
		this.baseline = baseline;
		this.options.put("baseline", "baseline:" + baseline);
	}

	/**
	 * Gets the distance value
	 * 
	 * @return the distance value
	 */
	public int getDistance()
	{
		return distance;
	}

	/**
	 * Sets the distance option value
	 * 
	 * @param distance
	 *            magnifier distance
	 */
	public void setDistance(int distance)
	{
		this.distance = distance;
		this.options.put("distance", "distance:" + distance);
	}

	/**
	 * Gets the magnification value
	 * 
	 * @return the magnification value
	 */
	public double getMagnification()
	{
		return magnification;
	}

	/**
	 * Sets the magnification option value
	 * 
	 * @param magnification
	 *            magnifier magnification
	 */
	public void setMagnification(float magnification)
	{
		this.magnification = magnification;
		this.options.put("magnification", "magnification:" + magnification);
	}

	/**
	 * Gets the opacity min value
	 * 
	 * @return the opacity min value
	 */
	public int getOpacityMin()
	{
		return opacityMin;
	}

	/**
	 * Sets the opacityMin option value
	 * 
	 * @param opacityMin
	 *            magnifier min opacity
	 */
	public void setOpacityMin(int opacityMin)
	{
		this.opacityMin = opacityMin;
		this.options.put("opacity", "opacity:{opacityMin:" + this.opacityMin + ", opacityMax:" + this.opacityMax + "}");
	}

	/**
	 * Gets the opacity max value
	 * 
	 * @return the opacity max value
	 */
	public int getOpacityMax()
	{
		return opacityMax;
	}

	/**
	 * Sets the opacityMax option value
	 * 
	 * @param opacityMax
	 *            magnifier max opacity
	 */
	public void setOpacityMax(int opacityMax)
	{
		this.opacityMax = opacityMax;
		this.options.put("opacity", "opacity:{opacityMin:" + this.opacityMin + ", opacityMax:" + this.opacityMax + "}");
	}

	/**
	 * Gets the zIndex value
	 * 
	 * @return the zIndex value
	 */
	public int getZIndex()
	{
		return zIndex;
	}

	/**
	 * Sets the zIndex option value
	 * 
	 * @param index
	 *            magnifier zIndex
	 */
	public void setZIndex(int index)
	{
		zIndex = index;
		this.options.put("zIndex", "zIndex:" + zIndex);
	}

	/**
	 * Gets the verticalLine value
	 * 
	 * @return the verticalLine value
	 */
	public double getVerticalLine()
	{
		return verticalLine;
	}

	/**
	 * Sets the verticalLine option value
	 * 
	 * @param verticalLine
	 *            magnifier verticalLine
	 */
	public void setVerticalLine(float verticalLine)
	{
		this.verticalLine = verticalLine;
		this.options.put("verticalLine", "verticalLine:" + verticalLine);
	}

	/**
	 * Gets the overlap value
	 * 
	 * @return the overlap value
	 */
	public boolean isOverlap()
	{
		return overlap;
	}

	/**
	 * Sets the overlap option value
	 * 
	 * @param overlap
	 *            magnifier overlap
	 */
	public void setOverlap(boolean overlap)
	{
		this.overlap = overlap;
		this.options.put("overlap", "overlap:" + overlap);
	}

	/**
	 * Gets the click script value
	 * 
	 * @return the click script value
	 */
	public String getClickScript()
	{
		return clickScript;
	}

	/**
	 * Sets the click function
	 * 
	 * @param clickScript
	 *            magnifier click function
	 */
	public void setClickScript(String clickScript)
	{
		this.clickScript = clickScript;
		this.options.put("click", "click:function(e, ui){" + clickScript + "}");
	}

	@Override
	protected Object clone() throws CloneNotSupportedException
	{
		JQMagnifierOptions clone = (JQMagnifierOptions) super.clone();
		return clone;
	}

}
